package org.jsola.hr.web;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.jsola.approval.vo.UserApproVO;
import org.jsola.core.Page;
import org.jsola.core.Result;
import org.jsola.hr.dto.CostBillAddDTO;
import org.jsola.hr.dto.CostBillApproveDTO;
import org.jsola.hr.dto.CostBillConfirmDTO;
import org.jsola.hr.dto.CostBillUpdateDTO;
import org.jsola.hr.query.CostBillQuery;
import org.jsola.hr.vo.*;
import org.springframework.core.io.Resource;
import org.springframework.http.ResponseEntity;

import java.util.List;

/**
 * 费用账单
 *
 * @author zhr
 */
@Api(tags = "hr-费用账单")
public interface ICostBillControllerAPI {

    /**
     * 新增费用账单
     *
     * @param costBillAddDTO 费用账单新增实体
     * @return 费用账单展示对象
     */
    @ApiOperation(value = "新增费用账单")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "costBillAddDTO", dataType = "CostBillAddDTO", value = "新增费用账单", paramType = "body")
    })
    Result<CostBillVO> save(CostBillAddDTO costBillAddDTO);


    /**
     * 修改费用账单
     *
     * @param costBillUpdateDTO 费用账单
     * @return 更新数量
     */
    @ApiOperation(value = "修改费用账单")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "costBillUpdateDTO", dataType = "CostBillUpdateDTO", value = "修改费用账单", paramType = "body")
    })
    Result<Integer> update(CostBillUpdateDTO costBillUpdateDTO);


    /**
     * 删除单个费用账单，彻底删除
     *
     * @param costBillId 费用账单id
     * @return 删除数量
     */
    @ApiOperation(value = "删除单个费用账单，彻底删除")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "costBillId", dataType = "Long", value = "费用账单id", paramType = "path")
    })
    Result<Integer> delete(Long costBillId);


    /**
     * 批量删除费用账单，彻底删除
     *
     * @param costBillIds 费用账单id集合
     * @return 删除数量
     */
    @ApiOperation(value = "批量删除费用账单，彻底删除")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "costBillIds", dataType = "Long[]", value = "费用账单id数组", paramType = "body", allowMultiple = true)
    })
    Result<Integer> deleteBatch(Long[] costBillIds);


    /**
     * 根据费用账单id查询费用账单详情
     *
     * @param costBillId 费用账单id
     * @return 费用账单详情
     */
    @ApiOperation(value = "根据费用账单id查询费用账单详情")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "costBillId", dataType = "Long", value = "费用账单id", paramType = "path")
    })
    Result<CostBillVO> findById(Long costBillId);


    /**
     * 查询费用账单
     *
     * @param costBillQuery 费用账单查询参数
     * @return page
     */
    @ApiOperation(value = "查询费用账单")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "costBillQuery", dataType = "CostBillQuery", value = "费用账单查询参数", paramType = "query")
    })
    Result<List<CostBillListVO>> listAll(CostBillQuery costBillQuery);


    /**
     * 分页查询费用账单
     *
     * @param costBillQuery 费用账单查询参数
     * @return page
     */
    @ApiOperation(value = "分页查询费用账单")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "costBillQuery", dataType = "CostBillQuery", value = "费用账单查询参数", paramType = "query")
    })
    Result<Page<CostBillListVO>> page(CostBillQuery costBillQuery);

    /**
     * 分页查询费用账单(POST)
     *
     * @param costBillQuery 费用账单查询参数
     * @return page
     */
    @ApiOperation(value = "分页查询费用账单(POST)")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "costBillQuery", dataType = "CostBillQuery", value = "费用账单查询参数", paramType = "body")
    })
    Result<Page<CostBillListVO>> pagePost(CostBillQuery costBillQuery);



    /**
     * 系统生成费用账单
     *
     * @param costBillAddDTO 费用账单新增实体
     * @return 费用账单展示对象
     */
    @ApiOperation(value = "系统生成费用账单")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "costBillAddDTO", dataType = "CostBillAddDTO", value = "新增费用账单", paramType = "body")
    })
    Result<List<CostBillVO>> generatedBills(CostBillAddDTO costBillAddDTO);

    /**
     * 根据账单Id查询账单详情
     *
     * @param costBillId 账单Id
     * @return 账单详情
     */
    @ApiOperation(value = "根据账单Id查询账单详情")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "costBillId", dataType = "Long", value = "账单Id", paramType = "path")
    })
    Result<CostBillInfoGroupVO> selectCostBillInfoById(Long costBillId);

    /**
     * 导出账单详情
     *
     * @param costBillId 账单Id
     * @return Excel
     */
    @ApiOperation(value = "导出账单详情")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "costBillId", dataType = "Long", value = "账单Id", paramType = "path")
    })
    ResponseEntity<Resource> export(Long costBillId);

    /**
     * 发起审批
     *
     * @param costBillApproveDTO 账单Id
     * @return 审批详情
     */
    @ApiOperation(value = "发起审批")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "costBillApproveDTO", dataType = "CostBillApproveDTO", value = "费用账单审批对象", paramType = "body")
    })
    Result<UserApproVO> launchApproveByCompanyId(CostBillApproveDTO costBillApproveDTO);

    /**
     * 根据月工资汇总表查询费用账单
     *
     * @param monthSalaryId 月工资汇总表id
     * @return 审批详情
     */
    @ApiOperation(value = "根据月工资汇总表查询费用账单")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "monthSalaryId", dataType = "Long", value = "月工资汇总表id", paramType = "param")
    })
    Result<CostBillVO> selectByMonthSalaryId(Long monthSalaryId);

    /**
     * 查询费用账单包含的用工单位
     *
     * @param costBillId 费用账单id
     * @return 审批详情
     */
    @ApiOperation(value = "查询费用账单包含的用工单位")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "costBillId", dataType = "Long", value = "费用账单id", paramType = "param")
    })
    Result<List<CompanyVO>> selectCompanyByCostBillId(Long costBillId);

    /**
     * 根据审批Id查询账单列表详情
     *
     * @param userApprovalId 审批Id
     * @return 账单列表详情
     */
    @ApiOperation(value = "根据审批Id查询账单列表详情")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "userApprovalId", dataType = "String", value = "审批id", paramType = "query")
    })
    Result<CostBillApprovalInfoVO> selectByUserApprovalId(String userApprovalId);

    /**
     * 确认账单
     *
     * @param costBillConfirmDTO 确认账单对象参数
     * @return 成功数量
     */
    @ApiOperation(value = "确认账单")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "costBillConfirmDTO", dataType = "CostBillConfirmDTO", value = "确认账单", paramType = "body")
    })
    Result<Integer> confirmCostBill(CostBillConfirmDTO costBillConfirmDTO);
}

